package com.cyf.db.bean;

import com.cyf.util.DateUtil;

import java.util.Date;
import java.util.Random;

/**
 * 访客记录
 * Created by cage on 2017/9/18.
 */
public class VisitorRecord {

    /** 0-待同意访问 **/
    public static final int STATUS_WAIT_PASS = 0;
    /** 1-同意访问 **/
    public static final int STATUS_PASS = 1;
    /** 2-拒绝访问 **/
    public static final int STATUS_NOTPASS = 2;
    /** 3-访问结束 **/
    public static final int STATUS_FINISHED = 3;
    /** 4-订单过期结束访问 **/
    public static final int STATUS_EXPIRATION = 4;
    /** 5-访客主动取消访问 **/
    public static final int STATUS_CANCEL = 5;
    /** 6-正在访问中 **/
    public static final int STATUS_MEETING = 6;

    private int id;
    private int intervieweeId;          // 受访者id
    private int visitorId;              // 访客id
    private String mobile;              // 被访客手机号
    private Date createdTime;           // 创建时间
    private Date estimateVisitorTime;   // 预计访客时间
    private Date endTime;               // 访客截止时间（有效期）
    private Date visitorTime;           // 实际访客时间
    private int status;                 // 访客记录状态
    private String name;                // 访客姓名
    private String memo;                // 访客留言
    private String rejectMemo;          // 拒绝理由
    private String orderNo;             // 订单编号
    private int apiUserId;

    // 查询字段
    private String plate;

    /**
     * 获取状态描述
     * @return  String
     */
    public String getStatusDesc() {
        switch (this.getStatus()) {
            case VisitorRecord.STATUS_WAIT_PASS:
                return "待处理";
            case VisitorRecord.STATUS_PASS:
                return "已同意";
            case VisitorRecord.STATUS_NOTPASS:
                return "已拒绝";
            case VisitorRecord.STATUS_FINISHED:
                return "访客结束";
            case VisitorRecord.STATUS_EXPIRATION:
                return "订单已过期";
            case VisitorRecord.STATUS_CANCEL:
                return "访客已取消申请";
            case VisitorRecord.STATUS_MEETING:
                return "会面中";
            default: {
                return "未知";
            }
        }
    }

    public static String generateOrderNo() {
        String timeStr = DateUtil.formatDate(new Date(), "yyyyMMddHHmmssSSS");
//        int randomInt = new Random().nextInt(9999);
//        String randomStr = String.format("%04d", randomInt);
        return timeStr;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getIntervieweeId() {
        return intervieweeId;
    }

    public void setIntervieweeId(int intervieweeId) {
        this.intervieweeId = intervieweeId;
    }

    public int getVisitorId() {
        return visitorId;
    }

    public void setVisitorId(int visitorId) {
        this.visitorId = visitorId;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getEstimateVisitorTime() {
        return estimateVisitorTime;
    }

    public void setEstimateVisitorTime(Date estimateVisitorTime) {
        this.estimateVisitorTime = estimateVisitorTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getVisitorTime() {
        return visitorTime;
    }

    public void setVisitorTime(Date visitorTime) {
        this.visitorTime = visitorTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getPlate() {
        return plate;
    }

    public void setPlate(String plate) {
        this.plate = plate;
    }

    public String getRejectMemo() {
        return rejectMemo;
    }

    public void setRejectMemo(String rejectMemo) {
        this.rejectMemo = rejectMemo;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public int getApiUserId() {
        return apiUserId;
    }

    public void setApiUserId(int apiUserId) {
        this.apiUserId = apiUserId;
    }
}
